import Home from "../views/home.vue";
import User from "../views/user.vue";
import MusicManagement from "../views/MusicManagement.vue";
import MusicPlay from "../views/MusicPlay.vue";
import Find from "../views/Find.vue";
import { createRouter, createWebHashHistory } from "vue-router";

const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        { path: '/', redirect: '/home', meta: { title: '首页', name: 'home' } },
        { path: '/home', component: Home, meta: { title: '首页' } },
        { path: '/musicmanagement', component: MusicManagement, meta: { title: '音乐管理' } },
        { path: '/musicplay', component: MusicPlay, meta: { title: '音乐播放'} },
        { path: '/find', component: Find, meta: { title: '发现' } },
        { path: '/user', component: User, meta: { title: '个人中心' } }
    ]
})
router.beforeEach((to,from,next)=>{
    document.title=to.meta.title;
    next();
})
export default router